#!/usr/bin/env bash
# - install
# - repo
# - repo1
# - repo2
# - repo3

has_new_repo=

add_repo()
{
	local name=$1
	local baseurl=$2

	[ -n "$baseurl" ] || return

	has_new_repo=1

	cat <<-EOF >> /etc/yum.repos.d/$name.repo
	[$name]
	name=$name
	baseurl=$baseurl
	enabled=1
	gpgcheck=0
	priority=100
	EOF
}

add_repo repo  $repo
add_repo repo1 $repo1
add_repo repo2 $repo2
add_repo repo3 $repo3

[ -n "$has_new_repo" ] && yum -y makecache

[ -n "$install" ] && yum install -y -q --skip-broken $install
